package com.neardrug.system;

import com.neardrug.mapper.*;
import com.neardrug.services.ExamplesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * 获取特定值(用于提供给静态方法)
 */
@Component
public class StaticProvider {

    private static ApplicationContext context;

    @Autowired
    public StaticProvider(ApplicationContext applicationContext) {
        context = applicationContext;
    }

    public static String getFileBaseUrl() {
        // 从环境中获取 fileBaseUrl
        return context.getEnvironment().getProperty("fileBaseUrl");
    }

    public static AnalysisMapper getAnalysisMapper(){
        return context.getBean(AnalysisMapper.class);
    }
    public static MarkdownMapper getMarkdownMapper(){
        return context.getBean(MarkdownMapper.class);
    }
    public static RecordMapper getRecordMaooer(){
        return context.getBean(RecordMapper.class);
    }
    public static ExamplesMapper getExamplesMapper(){
        return context.getBean(ExamplesMapper.class);
    }
    public static ExamplesService getExamplesService(){
        return context.getBean(ExamplesService.class);
    }
    public static ImagesMapper getImagesMapper(){
        return context.getBean(ImagesMapper.class);
    }
    public static FormImgMapper getFormImgMapper(){
        return context.getBean(FormImgMapper.class);
    }
    public static FormTableMapper getFormTableMapper(){
        return context.getBean(FormTableMapper.class);
    }
    public static NumeratorMapper getNumeratorMapper(){
        return context.getBean(NumeratorMapper.class);
    }
}

